import com.google.common.collect.ImmutableMultiset;
import com.google.common.collect.Multisets;

import java.util.ArrayList;

public class VirtualSmartPerebor {
    public static void main(String args[]) {
        ArrayList<Integer> smartList = new ArrayList<Integer>();
        int[] arrayFish = {21, 23, 25, 30, 35};
        int[] arrayDivergence = {7, 7, 5, 3, 2};
        for (int i = 0; i < arrayFish.length; i++) {
            for (int j = 0; j < arrayDivergence.length; j++) {
                smartList.add(arrayFish[i] + arrayDivergence[j]);
                smartList.add(arrayFish[i] - arrayDivergence[j]);
            }
        }
        System.out.println(smartList);
        Integer mostCommon = Multisets.copyHighestCountFirst(ImmutableMultiset.copyOf(smartList)).iterator().next();
        System.out.println(mostCommon);
    }
}
